// src/entities/event-log.entity.ts
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';

@Entity('event_logs')
export class EventLog {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ length: 50 })
  source: string; // server-01, api-gateway

  @Column({ length: 20 })
  level: 'INFO' | 'WARN' | 'ERROR' | 'CRITICAL';

  @Column({ length: 200 })
  message: string;

  @Column({ type: 'json', nullable: true })
  metadata: any;

  @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
  timestamp: Date;
}
